package com.weitu.worklicense.service.impl;

import com.weitu.worklicense.entity.LicenseMeasure;
import com.weitu.worklicense.entity.LicenseMeasureCriteria;
import com.weitu.worklicense.mapper.LicenseMeasureMapper;
import com.weitu.worklicense.service.LicenseMeasureService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Service
public class LicenseMeasureServiceImpl implements LicenseMeasureService {
    private final LicenseMeasureMapper licenseMeasureMapper;

    private static final Logger logger = LoggerFactory.getLogger(LicenseMeasureServiceImpl.class);

    @Autowired
    public LicenseMeasureServiceImpl(LicenseMeasureMapper licenseMeasureMapper) {
        this.licenseMeasureMapper = licenseMeasureMapper;
    }

    @Override
    public int countByCriteria(LicenseMeasureCriteria example) {
        int count = this.licenseMeasureMapper.countByCriteria(example);
        logger.debug("count: {}", count);
        return count;
    }

    @Override
    public LicenseMeasure selectByPrimaryKey(String id) {
        return this.licenseMeasureMapper.selectByPrimaryKey(id);
    }

    @Override
    public List<LicenseMeasure> selectByCriteria(LicenseMeasureCriteria example) {
        return this.licenseMeasureMapper.selectByCriteria(example);
    }

    @Override
    @Transactional
    public int deleteByPrimaryKey(String id) {
        return this.licenseMeasureMapper.deleteByPrimaryKey(id);
    }

    @Override
    @Transactional
    public int deleteByLicenseId(String licenseId) {
        return this.licenseMeasureMapper.deleteByLicenseId(licenseId);
    }

    @Override
    @Transactional
    public int updateByPrimaryKeySelective(LicenseMeasure record) {
        return this.licenseMeasureMapper.updateByPrimaryKeySelective(record);
    }

    @Override
    @Transactional
    public int updateByCriteriaSelective(LicenseMeasure record, LicenseMeasureCriteria example) {
        return this.licenseMeasureMapper.updateByCriteriaSelective(record, example);
    }

    @Override
    @Transactional
    public int insertSelective(LicenseMeasure record) {
        return this.licenseMeasureMapper.insertSelective(record);
    }
}